﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SQLExecute;
using System.Data;


/// <summary>
/// Summary description for profiles
/// </summary>
public class Profiles
{

    public Guid _id;
    DataSet ds;
    
    private string _fullname;
    private DateTime _birth;
    private string _sex;
    private int _height;
    private int _weight;
    private string _married;
    private string _phone;
    private string _mail;

    private int _district_permanent_address;
    private string _permanent_address;
    private string _current_address;
    private string _idcard;
    private string _relocate;
    private string _aptitude;


    public Profiles()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public Guid ID
    {
        set { _id = value; }
        get { return _id; }
    }

    public string ProfileType
    {
        set { _profile_type = value; }
        get { return _profile_type; }
    }
    public string PositionApply
    {

        set
        {
            _position_apply = value;
        }
        get { return _position_apply; }
    }
    public DateTime AvailableDate
    {
        set { _available_date = value; }
        get { return _available_date; }
    }
    public int ExpectedSalary
    {
        set { _expected_salary = value; }
        get { return _expected_salary.Value; }
    }
    public string CurrencySalary
    {
        set { _currency_salary = value; }
        get { return _currency_salary; }
    }
    private int _known_us_from;
    public int KnownUsFrom
    {
        set {_known_us_from=value;}
        get {return _known_us_from;}
    }

    /*---------------------------- Personal--------------------*/

    public string Fullname
    {
        set { _fullname = value; }
        get { return _fullname; }
    }
    public DateTime Birth
    {
        set { _birth = value; }
        get { return _birth; }
    }
    public string Sex
    {
        set { _sex = value; }
        get { return _sex; }

    }
    public int Height
    {
        set 
        { 
        
            _height = value; 
           
        }
        get { return _height; }
    }
    public int Weight
    {
        set { _weight = value; }
        get { return _weight; }
    }
    public string Phone
    {
        set { _phone = value; }
        get { return _phone; }
    }
    public string Mail
    {
        set { _mail = value; }
        get { return _mail; }
    }
    public string Married
    {
        set { _married = value; }
        get { return _married; }
    }

    private string _number_of_childrens;
    public string NumberOfChildrens
    {
        set { _number_of_childrens = value; }
        get { return _number_of_childrens; }
    }

    private string _others_martial_status;
    public string OthersMartialStatus
    {
        set { _others_martial_status = value; }
        get { return _others_martial_status; }
    }

    public string PermanentAddress
    {
        set { _permanent_address = value; }
        get { return _permanent_address; }
    }
    public int DistrictPermanentAddress
    {
        set { _district_permanent_address = value; }
        get { return _district_permanent_address; }
    }
    private int _district_current_address;
    public int DistrictCurrentAddress
    {
        set { _district_current_address = value; }
        get { return  _district_current_address; }
    }
    public string CurrentAddress
    {
        set { _current_address = value; }
        get { return _current_address; }
    }
    public string IDCard
    {
        set {  _idcard=value; }
        get { return _idcard; }
    }

    DateTime _dateIssueIDCard;

    public DateTime DateIssueIDCard
    {
        set { _dateIssueIDCard = value; }
        get { return _dateIssueIDCard; }
    }
    string _placeIssueIDCard;
    public string PlaceIssueIDCard
    { 
    
        set{_placeIssueIDCard=value;}
        get{return _placeIssueIDCard;}
    }
    public string Relocate
    {
        set { _relocate = value; }
        get { return _relocate; }
    }
    public string Aptitude
    {
        set { _aptitude = value; }
        get { return _aptitude; }
    
    }
   
    public string _city;
    public string City
    {
        set { _city = value; }
        get { return _city; }
    }

   
    /*-------------------Danh gia---------------*/


    public DateTime _interviewdate;

    public DateTime InterviewDate
    {
        set { _interviewdate = value; }
        get {return _interviewdate; }
    }

    public string _member_interview;
    public string MemberInterView
    {
        set { _member_interview = value; }
        get { return _member_interview; }
    }
  

   
    /*---------------Insert Info --------------*/
   
    private string _profile_type;
    private string _position_apply;
    private DateTime _available_date;
    private int? _expected_salary=null;
    private string _currency_salary;
    public string _carreer_objectives;
    public string CarreerObjectives
    {
        set { _carreer_objectives = value; }
        get { return _carreer_objectives; }
    }
    public void Insert_Basic_Info()
    {

        
        SqlHelper.ExecuteNonQuery(Common.strConnect, "Insert_Basic_Info",
                                    new object[]{ this.ID, this._profile_type
                                                 , this._position_apply,this._available_date
                                                 , this._expected_salary, this._currency_salary,this._known_us_from,this._carreer_objectives});
    }
    /*---------------Insert Profiles----------------------*/

    private string _image_URL;

    public string ImageURL
    {
        set { this._image_URL = value; }
        get { return this._image_URL; }
    }
    public void Insert_Profile()
    {
        

        SqlHelper.ExecuteNonQuery(Common.strConnect, "Insert_Profile"
                                  , new object[]{this._id
                                                ,this._fullname
                                                ,this._birth                                              
                                                ,this._sex
                                                ,this._height
                                                ,this._weight
                                                ,this._phone
                                                ,this._mail
                                                ,this._married
                                                ,this._number_of_childrens
                                                ,this._others_martial_status
                                                ,this._idcard
                                                ,this._dateIssueIDCard
                                                ,this._placeIssueIDCard
                                                ,this._permanent_address                                               
                                                ,this._current_address                                                
                                                ,this._relocate
                                                ,this._aptitude   
                                                ,DateTime.Now.ToShortDateString()
                                                ,this._image_URL                                                
                                                ,true
                                                });
        
    }
   
    /*-----------------------Slect ***************/
    public void Get_List_User()
    { 
        
    }
    public DataSet Get_List_Profiles_Rejected()
    {

        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Get_List_Profiles_Rejected");

        return ds;
    }
    public DataSet Get_List_Profiles(string school_id, string majorsubject, int salfrom, int salto, int knownfrom)
    {

        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Get_List_Profiles", new object[] { school_id, majorsubject, salfrom, salto, knownfrom });

        return ds;
    }
    public DataSet Get_Profile()
    {


        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Get_Profile", new object[] { this._id });
         
        
        

        return ds;
    }


    public DataSet Get_Profile2()
    {


        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Get_Profile2", new object[] { this._id });



        return ds;
    }

    /*---------------------- Update ------------------------*/

    public void Update_Basic_Info()
    {

        SqlHelper.ExecuteNonQuery(Common.strConnect, "Update_Basic_Info",
                                    new object[]{this._id, this._profile_type
                                                 , this._position_apply,this._available_date
                                                 , this._expected_salary, this._currency_salary,this._known_us_from
                                                 ,this._carreer_objectives});
    }
    public void Update_Profile()
    {

        

        SqlHelper.ExecuteNonQuery(Common.strConnect, "Update_Profile"
                                  , new object[]{this._id
                                                ,this._fullname
                                                ,this._birth                                              
                                                ,this._sex
                                                ,this._height
                                                ,this._weight
                                                ,this._phone
                                                ,this._mail
                                                ,this._married
                                                ,this._number_of_childrens
                                                ,this._others_martial_status
                                                ,this._idcard
                                                ,this._dateIssueIDCard
                                                ,this._placeIssueIDCard
                                                ,this._permanent_address
                                                ,this._city
                                                ,this._district_permanent_address
                                                ,this._current_address
                                                ,this._district_current_address
                                                ,this._relocate
                                                ,this._aptitude   
                                                ,DateTime.Now.ToShortDateString()
                                                ,this._image_URL
                                                });

    }


    public void Insert_All_Profile_ID(string strFullName,DateTime dt)
    {
        SqlHelper.ExecuteNonQuery(Common.strConnect, "Insert_All_ID", 
                                   new object[] { this._id,strFullName,dt.ToShortDateString()});
    }
 

    

}
